<?php defined('NABU') || exit ?>
<?php use nabu\libs\utils\utils ?>
<div class="overlay"></div>
<nav class="nav">
  <figure class="nav__logo-wrapper">
    <img class="nav__logo" src="<?= NABU_DIRECTORY['images'] ?>/nabu-logo.svg" alt="Logo de nabu">
  </figure>
  <span class="nav__burger-icon" id="control-menu"></span>
  <ul class="nav__menu" id="menu">
        <li class="nav__item-logo">
           <a href="<?= NABU_ROUTES['home'] ?>">
              <img class="nav__logo" src="<?= NABU_DIRECTORY['images'] ?>/nabu-logo.svg" alt="Logo de nabu">
          </a>
        </li>
        <!-- <li class="nav__item">
          <span></span><a href="<?= NABU_ROUTES['home'] ?>">Inicio</a>
        </li> -->
        <li class="nav__item">
          <span></span><a href="<?= NABU_ROUTES['all_articles'] ?>">Articulos</a>
        </li>
        <?php if (!utils::session_exists()): ?>
          <li class="nav__item">
            <span></span><a href="<?= NABU_ROUTES['login'] ?>">Inicia sesión</a>
          </li>
          <li class="nav__item">
            <span></span><a href="<?= NABU_ROUTES['signup'] ?>">Comienza a escribir</a>
          </li>
        <?php else: ?>
          <li class="nav__item">
            <a href="<?= NABU_ROUTES['sent'] ?>">Artículos enviados</a>
          </li>
          <li class="nav__item">
            <a href="<?= NABU_ROUTES['favorites'] ?>">Favoritos</a>
          </li>
          <li class="nav__item">
            <a href="<?= NABU_ROUTES['post'] ?>">Publicar un post</a>
          </li>
          <?php if (utils::is_admin()): ?>
            <li class="nav__item">
              <a href="<?= NABU_ROUTES['admin'] ?>">Administración</a>
            </li>
          <?php endif ?>
          <?php $author = $_SESSION['user']['username'] ?>
          <li class="nav__item">
            <a href="<?= NABU_ROUTES['profile'] . '&user=' . urlencode($author) ?>"><?= utils::str_escape($author) ?></a>
          </li>
          <li class="nav__item">
            <span></span><a href="<?= NABU_ROUTES['logout'] ?>">Cerrar sesión</a>
          </li>
        <?php endif ?>
    </ul>
</nav>

<!-- <form method="post" action="<?= NABU_ROUTES['home'] ?>">
    <input type="hidden" name="csrf" value="<?= $token ?>">
    <span>
      <input type="text" name="q" minlength="1" maxlength="246" required>
    </span>
    <span>
      <input type="submit" name="search_submit" value="&#x1F50E">
    </span>
</form> -->
